using System;
using System.Globalization;
using System.Data;
using System.Threading;

/*=====================================================================

  File:      WorldReady.cs for Adventure Works Cycles Storefront Sample
  Summary:   Middle tier component which supports the globalization and localizability of the sample..
  Date:	     April 7, 2004

---------------------------------------------------------------------

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= */
namespace Microsoft.Samples.SqlServer
{
	/// <summary>
	/// Summary description for WorldReady.
	/// </summary>
	public sealed class WorldReady
	{
		public readonly static CultureInfo USCulture = CultureInfo.CreateSpecificCulture("EN-US");

		private WorldReady()
		{
			//
			// TODO: Add constructor logic here
			//
		}
		public static void SetCulture(CultureInfo culture)
		{
			// Set the CurrentCulture property to the requested culture.
			Thread.CurrentThread.CurrentCulture = culture;

			// Initialize the CurrentUICulture property
			// with the CurrentCulture property.
			Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
		}
		//Return the three letter ISO currency code for the current thread.
		//TODO: Consider caching in thread local storage
		public static String CurrentCurrencyCode()
		{
			return new RegionInfo(Thread.CurrentThread.CurrentCulture.LCID).ISOCurrencySymbol;
		}
		// Returns the requested language as a two letter ISO code in uppercase.
		public static String CurrentLanguage()
		{
			return Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper(CultureInfo.CreateSpecificCulture("EN-US"));
		}
	}
}
